<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/10
 * Time: 10:56
 */

include "config.php";
include "status.php";


if($_SERVER["REQUEST_METHOD"] != "POST"){
    print_r(json_encode(Status::$r_0));
    return;
}
if(isset($_REQUEST["uname"]) && isset($_REQUEST["upwd"])){


    $UNAME = $_REQUEST["uname"];
    $UPWD = $_REQUEST["upwd"];


    $sql = "SELECT  `u_id`,`u_name` FROM sasauserinfo WHERE u_name=? AND u_pwd=? ;";

    $stmt = $conn->prepare($sql);
    $stmt->bind_param("ss", $UNAME, $UPWD);

    $stmt->execute();

    $resultArr=$stmt->get_result();

    if($resultArr->num_rows>=1){
        Status::$login_success["data"]=$resultArr->fetch_assoc();
        print_r(json_encode(Status::$login_success));
    }else{
        print_r(json_encode(Status::$login_error));
    }

    $stmt->close();
    $conn->close();
} else {
    print_r(json_encode(Status::$login_Null));
}

